//
//  GalaxyLight.m
//  MyFirstGame
//
//  Created by Thi Huynh on 3/1/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "GalaxyLight.h"

@implementation GalaxyLight
-(id) init
{
	return [self initWithTotalParticles:50];
}

-(id) initWithTotalParticles:(NSUInteger)p
{
	if( (self=[super initWithTotalParticles:p]) ) {
        
		// duration
		//duration = kCCParticleDurationInfinity;
        duration=0.15;
		// Gravity Mode
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 120;
		self.speedVar = 80;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
        
		
		// angle
		angle = 90;
		angleVar = 360;
        
		// emitter position
		CGSize winSize = [[CCDirector sharedDirector] winSize];
		self.position = ccp(winSize.width/2, winSize.height/2);
		posVar = CGPointZero;
		
		// life of particles
		life = 1.3f;
		lifeVar = 1.0;
		
		// size, in pixels
		startSize = 15;
		startSizeVar = 8;
		endSize = 0;
        
		// emits per second
		emissionRate = totalParticles/duration;
		
		
		// color of particles
		startColor.r = 1;
		startColor.g = 1;
		startColor.b = 1;
		startColor.a = 1.0f;
		startColorVar.r = 1;
		startColorVar.g = 1;
		startColorVar.b = 1;
		startColorVar.a = 1;
		endColor.r = 0.0f;
		endColor.g = 0.0f;
		endColor.b = 0.0f;
		endColor.a = 1.0f;
		endColorVar.r = 0.0f;
		endColorVar.g = 0.0f;
		endColorVar.b = 0.0f;
		endColorVar.a = 0.0f;
		
		self.texture = [[CCTextureCache sharedTextureCache] addImage: @""];
        
		// additive
		self.blendAdditive = YES;
	}
	
	return self;
}

-(id) initWithMenuUI:(NSUInteger)p
{
	if( (self=[super initWithTotalParticles:20]) ) {
        
		// duration
		//duration = kCCParticleDurationInfinity;
        duration=0.2;
		// Gravity Mode
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 120;
		self.speedVar = 80;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
        
		
		// angle
		angle = 90;
		//angleVar = 360;
        
		// emitter position
		CGSize winSize = [[CCDirector sharedDirector] winSize];
		self.position = ccp(winSize.width/2, winSize.height/2);
		posVar = CGPointZero;
		
		// life of particles
		life = 1.5f;
		lifeVar = 1.2;
		
		// size, in pixels
		startSize = 1;
		startSizeVar = 2;
		endSize = 20;
        
		// emits per second
		emissionRate = totalParticles/duration;
		
		
		// color of particles
		startColor.r = 1;
		startColor.g = 1;
		startColor.b = 1;
		startColor.a = 1.0f;
		startColorVar.r = 1;
		startColorVar.g = 1;
		startColorVar.b = 1;
		startColorVar.a = 1;
		endColor.r = 0.0f;
		endColor.g = 0.0f;
		endColor.b = 0.0f;
		endColor.a = 1.0f;
		endColorVar.r = 0.0f;
		endColorVar.g = 0.0f;
		endColorVar.b = 0.0f;
		endColorVar.a = 0.0f;
		
		self.texture = [[CCTextureCache sharedTextureCache] addImage: @""];
        
		// additive
		self.blendAdditive = YES;
	}
	
	return self;
}

@end
